#pragma once

#include <memory>
#include "messaging/dispatcher.h"


namespace evm { namespace messaging {

struct BaseExecutor {
    BaseExecutor(ListenerPtr listener, DispatcherPtr dispatcher)
    : listener(listener), dispatcher(dispatcher) {}

    virtual ~BaseExecutor() {}

    /* Start polling for incoming messages. */
    virtual void start() = 0;

    /* Stop polling for messages. */
    virtual void stop() = 0;

    /* Wait until the executor has stopped polling. */
    virtual void wait() = 0;

protected:
    ListenerPtr listener;
    DispatcherPtr dispatcher;
};

using ExecutorPtr = shared_ptr<BaseExecutor>;

}}


#include "impl_pooled.h"
